package com.xuecheng.content.feignclient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName MediaFallbackFactory
 * @Description TODO
 * @Author kiku
 * @Date 2024/9/23 20:50
 * @Version 1.0
 */
@Component
@Slf4j
public class MediaFallbackFactory implements FallbackFactory<MediaServiceClient> {
    @Override
    public MediaServiceClient create(Throwable throwable) {
        return new MediaServiceClient() {
            @Override
            public String upload(MultipartFile filedata, String objectName) {
                log.error("发生了异常，执行降级逻辑，异常信息:{}",throwable.toString());
                return null;
            }
        };
    }
}
